Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class NodaTime.​Text.​CompositePatternBuilder<​T>

Assembly: NodaTime

Inheritance: object → CompositePatternBuilder

Implemented Interfaces

A builder for composite patterns.

Remarks

A composite pattern is a combination of multiple patterns. When parsing, these are checked in the order in which they are added to the builder with the <see cref="M:NodaTime.Text.CompositePatternBuilder`1.Add(NodaTime.Text.IPattern{`0},System.Func{`0,System.Boolean})" /> method, by trying to parse and seeing if the result is a successful one. When formatting, the patterns are checked in the reverse order, using the predicate provided along with the pattern when calling <c>Add</c> . The intention is that patterns are added in "most precise first" order, and the predicate should indicate whether it can fully represent the given value - so the "less precise" (and therefore usually shorter) pattern can be used first.

Methods

public void
Add​(IPattern<​T> pattern, System.​Func<​T, bool> formatPredicate)
Adds a component pattern to this builder.
pattern The component pattern to use as part of the eventual composite pattern.
formatPredicate A predicate to determine whether or not this pattern is suitable for formatting the given value.
public IPattern<​T>
Build​()
Builds a composite pattern from this builder. Further changes to this builder will have no impact on the returned pattern.
Returns A pattern using the patterns added to this builder.
public bool
Equals​(object obj)
Inherited from object
protected void
Finalize​()
Inherited from object
public int
GetHashCode​()
Inherited from object
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object